import http from '@/utils/request'
import type { roleType, teamType, userType } from '@/types'

const queryUserList = () => {
  return http.post('/disp/sys/user/page', {
    status: 'Enable',
    pageNum: 1,
    pageSize: 9999999
  }).then(res => {
    return (res.data.list || []).map((item: userType) => {
      return {
        label: item.username,
        value: item.userCode
      }
    })
  })
}
const queryTeamList = () => {
  return http.post('/disp/biz/team/page', {
    status: 'Enable',
    pageNum: 1,
    pageSize: 9999999
  }).then(res => {
    return (res.data.list || []).map((item: teamType) => {
      return {
        label: item.teamName,
        value: item.id
      }
    })
  })
}
const queryRoleList = () => {
  return http.post('/disp/sys/role/page', {
    status: 'Enable',
    pageNum: 1,
    pageSize: 9999999
  }).then(res => {
    return (res.data.list || []).map((item: roleType) => {
      return {
        label: item.roleName,
        value: item.id
      }
    })
  })
}

export {
  queryUserList,
  queryTeamList,
  queryRoleList
}